package com.snail.model.entity;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * @author cici
 * @description 商品评论
 * @date 2025/8/19 15:55
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@Document(indexName = "biz_product_review")
public class ProductComment {
    @Id
    @Field(name = "id", type = FieldType.Integer)
    @JsonProperty("id")
    private Integer id;

    @Field(name = "product_id", type = FieldType.Integer)
    @JsonProperty("product_id")
    private Integer productId;

    @Field(name = "sku_id", type = FieldType.Integer)
    @JsonProperty("sku_id")
    private Integer skuId;

    @Field(name = "user_id", type = FieldType.Long)
    @JsonProperty("user_id")
    private Long userId;

    @Field(name = "score", type = FieldType.Byte)
    @JsonProperty("score")
    private Integer score;

    // ✅ content 分词
    @Field(name = "content", type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    @JsonProperty("content")
    private String content;

    @Field(name = "images", type = FieldType.Keyword)
    @JsonProperty("images")
    private String images;

    @Field(name = "videos", type = FieldType.Keyword)
    @JsonProperty("videos")
    private String videos;

    @Field(name = "status", type = FieldType.Byte)
    @JsonProperty("status")
    private Integer status;

    @Field(name = "create_time", type = FieldType.Date)
    @JsonProperty("create_time")
    private Date createTime;

    @Field(name = "update_time", type = FieldType.Date)
    @JsonProperty("update_time")
    private Date updateTime;

    @Field(name = "create_by", type = FieldType.Keyword)
    @JsonProperty("create_by")
    private String createBy;

    @Field(name = "update_by", type = FieldType.Keyword)
    @JsonProperty("update_by")
    private String updateBy;

    @Field(name = "parent_id", type = FieldType.Integer)
    @JsonProperty("parent_id")
    private Integer parentId;
}
